﻿using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Web;
using System.Windows.Forms;

namespace zielonka.co.uk.extensions.system.web.ui.webcontrols
{
    //Description:	Scrolls to the bottom of a Textbox.
    /*
       this.txtExample.ScrollToBottom();
     */


    public static partial class TextboxExtensions
	{
        /**
        * <summary>Scrolls to the bottom of a TextBox.</summary>
        *
        * <remarks>The scroll occurs by moving the caret and scrolling to it;
        * therefore you shouldn't use this method if caret placement is
        * important in your application.</remarks>
        */
        public static void ScrollToBottom(this System.Windows.Forms.TextBox box)
        {
            box.SelectionStart = box.TextLength;
            box.ScrollToCaret();
        }
	}
}
